home *** CD-ROM | disk | FTP | other *** search
- Path: news.chalmers.se!usenet
- From: ditt login@ios.chalmers.se (Ange ditt namn)
- Newsgroups: comp.lang.c++
- Subject: Stupid DialogBox() fails....
- Date: 10 Jan 1996 17:12:15 GMT
- Organization: Chalmers university of technology
- Message-ID: <4d0s1f$je2@nyheter.chalmers.se>
- Reply-To: ei39594@ios.chalmers.se
- NNTP-Posting-Host: sv320112.ios.chalmers.se
- X-Newsreader: WinVN 0.92.1
-
-
- Hi'
-
- I'm writing a Windowz based app. using BC4, and everything seems to work
- fine until I close BC and try to run my program without the IDE:
- and then EVERY STUPID DIALOGBOX() FAILS...
- I don't know why, but one thing is for sure: the code sshould be OK, I ripped it out
- from Borlands Example files :-)
- My program worked just fine if I had any of BC programs (e.g. Winsight) running,
- should i try compile it dynamic??
-
- I'm using Win95, but I had the same problem with wfwg3.11 and BC4.5
-
- The code looks like this:
- -------------------------
- DLGPROC AboutProc;
- HINSTANCE Hinst; /* make it global in main */
- BOOL CALLBACK _export AboutDlgProc(HWND hWnd,UINT msg,
- WPARAM wParam,LPARAM lParam){
- switch(msg){
- case WM_COMMAND:
- switch(wParam){
- case ABOUT_OK:
- EndDialog(hWnd,TRUE);
- break;
- }
- break;
- default: return FALSE;
- }
- return TRUE;
- }
-
- void About(HWND hWnd){
- AboutProc = (DLGPROC) MakeProcInstance((FARPROC)AboutDlgProc,Hinst);
- if(AboutProc){
- if(DialogBox(Hinst,"About",hWnd,AboutProc) == -1)
- MessageBox(hWnd,"INTERNAL: DialogBox() failed!",0L,MB_OK);
- FreeProcInstance((FARPROC) AboutProc);
- } else MessageBox(hWnd,"INTERNAL: MakePoocInstance() failed!",0L,MB_OK);
- }
-
- ------------------------
-
- As you see this is my first Windowz prog. :-)
-
- TIA, Arash
-
-